type str = array[0..1000010] of char;

var c:str; ls:longint; z:array[0..1000010] of longint; ch:char;

procedure ZF(s:str);
var l,r,i,k:longint;
begin
z[0]:=ls;
l:=0;
r:=0;
k:=ls-1;
for i:=1 to k do begin
	if z[i-l]+i<=r then z[i]:=z[i-l] else begin
		l:=i;
		if i>r then r:=i;
		z[i]:=r-i;
		while r<ls do begin
      if s[r]<>s[z[i]] then break;
			inc(r);
			inc(z[i]);
		end;
		dec(r);
	end;
end;	
end;

begin
fillchar(z,sizeof(z),0);
ls:=0;
read(ch);
while ch in ['a'..'z'] do begin
	c[ls]:=ch;
	inc(ls);
	read(ch);
end;
zf(c);
end.